<template>
	<view class="content">
		<block v-for="(item,index) in showList" :key="index">
			<view class="list" @click="gotoUser(item)">
				<view class="left">
					<image :src="item.head"></image>
				</view>
				<view class="right" v-if="item.type != '3'">
					<view>
						<text
							v-if="item.friendRemarks != undefined && item.friendRemarks != null && item.friendRemarks != ''">{{item.friendRemarks}}</text>
						<text v-else>{{item.nickname}}</text>
					</view>
					<view>
						<icon-gender-nv v-if="item.gender == 0"></icon-gender-nv>
						<icon-gender-nan v-else></icon-gender-nan>
					</view>
				</view>
				<view class="right-group" v-else>
					<view>
						<text>{{item.nickname}}</text>
					</view>
				</view>
			</view>
		</block>
	</view>
</template>

<script>
	//引入icon
	import iconGenderNv from '@/components/common/my-icon-gender-nv/my-icon-gender-nv.vue'
	import iconGenderNan from '@/components/common/my-icon-gender-nan/my-icon-gender-nan.vue'

	export default {
		components: {
			iconGenderNv,
			iconGenderNan
		},
		props: {
			showList: {
				type: Array,
				default: function() {
					return []
				}
			},
			type: {
				type: String,
				default: ''
			},
			//是否展示Rideo
			showRadio: {
				type: Boolean,
				default: false
			}
		},
		data() {
			return {

			}
		},
		methods: {
			gotoUser(item) {

				if (item.type == '2') {
					var req = {
						id: item.userId,
						nickname: item.nickname,
						head: item.head,
						type: 2 //用户单聊类型
					}
					// uni.navigateTo({
					// 	url: '/subpkg/msg/user/user-detail/user-detail?msgObject=' + JSON.stringify(req),
					// })


					uni.navigateTo({
						url: '/pages/newMsg/chat-user/chat-user?msgObject=' + JSON.stringify(req),
					})

					/* uni.navigateTo({
						url: '/pages/newMsg/chat-user/chat-user?msgObject=' + JSON.stringify(req),
					}) */

					return
				}
				if (item.type == '3') {
					var req = {
						id: item.userId,
						nickname: item.nickname,
						head: item.head,
						type: 3 //群聊类型
					}
					uni.navigateTo({
						url: '/pages/newMsg/chat-group/chat-group?msgObject=' + JSON.stringify(req),
					})
					return
				}

			}
		},
		created() {
			/* console.log(this.showList)
			console.log(this.type) */
		}
	}
</script>

<style lang="scss" scoped>
	.list {
		width: 94%;
		margin-left: 3%;
		padding: 20rpx 0;
		border-bottom: 1rpx solid rgba(229, 229, 229, 1);
		display: flex;

		.left {
			margin-right: 30rpx;

			image {
				width: 120rpx;
				height: 120rpx;
				border-radius: 50%;
			}
		}
	}



	.right {
		// display: flex;
		// line-height: 120rpx;

		text {
			font-size: 36rpx;
		}

		view {
			margin: 10rpx 0;
		}
	}

	.right-group {
		text {
			font-size: 36rpx;
		}

		line-height: 120rpx;
	}
</style>